#include "main.h"

extern uint16_t    Temperature;  	    
extern uint16_t    Humidity; 

extern uint16_t    SoilTemperature;  	    
extern uint16_t    SoilHumidity; 
extern uint16_t    SoilEC; 

extern uint16_t   LightLux;
extern uint16_t  co2Data,TVOCData;

void STA_device (void)
{
	
	if( 	
	Humidity<20
	||Temperature>28  	    
	||SoilTemperature>28  	    
	||SoilHumidity>100
	||SoilEC>800
	||LightLux<100
	||50000<LightLux
	||co2Data>800
	||350>co2Data
	||TVOCData>100
		)
	{
		POINT_COLOR=RED;
		LCD_ShowString(110,30,100,30,24,"WARNING");
		LCD_Fill(200,26,320,56,RED);
		for(uint8_t i=0;i<6;i++){

			HAL_GPIO_TogglePin(GPIOB,GPIO_PIN_8);
			HAL_Delay(500);
			}
		HAL_GPIO_WritePin (BEEP_GPIO_Port ,BEEP_Pin ,GPIO_PIN_RESET );	
	}
else{

		POINT_COLOR=GREEN;
		LCD_ShowString(110,30,170,30,24," GREAT ");
		LCD_Fill(200,26,320,56,GREEN);
	}
	
	
}	
	


//
